package com.srit.migration.business.dao.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

import com.srit.base.bean.Page;
import com.srit.base.dao.SqlMapDao;
import com.srit.migration.business.bean.Db;
import com.srit.migration.business.dao.DbDao;

/**
 * @author guan
 * @by daoImpl.tem
 * 
 */
 @Service
public class DbDaoImpl implements DbDao {
	@Autowired(required = true)
	private SqlMapDao sqlMapDao;

	@Override
	public void save(Db db) {
		sqlMapDao.save("Db.save", db);
	}

	@Override
	public void update(Db db) {
		sqlMapDao.update("Db.save", db);
	}

	@Override
	public Db getById(Db db) {
		return (Db) sqlMapDao.getById("Db.getById", db.getId());
	}

	@Override
	public void delete(Db db) {
		sqlMapDao.delete("Db.delete", db);
	}

	@Override
	public void page(Page page) {
		sqlMapDao.queryForObject("Db.page", page);
	}
	
	@Override
	public void batchSave(List<Db> dbList) {
		sqlMapDao.batchSave("Db.batchSave", dbList);

	}

	@Override
	public List list(Page page) {
		return sqlMapDao.queryForList("Db.list", page);

	}

}
